package shuiguo.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import shuiguo.bean.JinHuoDanBean;
import util.JDBCUtils;

public class JinHuoDanDao {
	Connection con=null;
	PreparedStatement  ps=null;
	public int insert(JinHuoDanBean jinhuo) {
		String sql="insert into s_jinhuodan(shuiguoname,danjia,number,jinhuomoney"+
	",jinhuodanjia) values(?,?,?,?,?)";
		try {
			con=JDBCUtils.getConnection();
			ps=con.prepareStatement(sql);
			ps.setString(1, jinhuo.getShuiGuoName());
			ps.setBigDecimal(2, jinhuo.getDanJia());
			ps.setInt(3, jinhuo.getNumber());
			ps.setBigDecimal(4, jinhuo.getJinHuoMoney());
			ps.setBigDecimal(5, jinhuo.getJinHuodanJia());
			return ps.executeUpdate();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return 0;
	}
}
